package Kalah;
	
	public class Position implements Cloneable{
		static final int ROTATE_CCW = -1;
		static final int ROTATE_CW = 1;
		static final int POT = 1;
		private int m_holeNumber;
		private int m_holesPerPlayer;
		private boolean m_isTop;
		
		public Position(boolean isTop, int holeNum){
			m_holeNumber = holeNum;
			m_isTop = isTop;
		}
		public Position(Position pos){
			m_holeNumber = pos.m_holeNumber;
			m_holesPerPlayer = pos.m_holesPerPlayer;
			m_isTop = pos.m_isTop;
		}
		public Object clone(){
			return new Position(this);
		}
		
		public int getHoleNumber(){
			return m_holeNumber;
		}
		public int getHolesPerPlayer(){
			return m_holesPerPlayer;
		}
		public boolean isTopPosition(){
			return m_isTop;
		}
		
		public void moveClockwise(){
			m_holeNumber += ROTATE_CW;
			if(m_holeNumber > m_holesPerPlayer){
				m_holeNumber = POT;
				m_isTop = !m_isTop;
			}
		}
		public void moveCCW(){
			m_holeNumber += ROTATE_CCW;
			if(m_holeNumber < POT){
				m_holeNumber = m_holesPerPlayer;
				m_isTop = !m_isTop;
			}
		}
		public void moveToOppositePosition(){
			m_holeNumber = m_holesPerPlayer - m_holeNumber;
			m_isTop = !m_isTop;
		}
	}